import Vue from "vue";
import Router from "vue-router";

const _import = require("./_import");

Vue.use(Router);

/**
 * icon : the icon show in the sidebar
 * hidden : if `hidden:true` will not show in the sidebar
 * redirect : if `redirect:noredirect` will not redirct in the levelbar
 * noDropdown : if `noDropdown:true` will not has submenu in the sidebar
 * meta : `{ role: ['admin'] }`  will control the page role
 **/
export const constantRouterMap = [
  {path: "/login", component: _import("login"), hidden: true},
  {path: "/logout", component: _import("login"), hidden: true},
  {
	path: "/",
	component: _import("index"),
	hidden: true,
	redirect: "/home",
	children: [
	  {
		path: "/home",
		name: "home",
		component: _import("layout/home"),
		hidden: true,
		meta: {title: "深大穿戴.陀螺仪"}
	  },
	]
  },
  {
	path: "/device",
	component: _import("index"),
	hidden: true,
	redirect: "/device/devices",
	children: [
	  {
		path: "/device/devices",
		name: "devices",
		component: _import("device/devices"),
		hidden: true,
		meta: {title: "设备管理"}
	  },
	  {
		path: "/device/config",
		name: "config",
		component: _import("device/config"),
		hidden: true,
		meta: {title: "设备配置"}
	  },
	  {
		path: "/device/gather",
		name: "gather",
		component: _import("device/gather"),
		hidden: true,
		meta: {title: "采集数据"}
	  },
	  {
		path: "/device/upload",
		name: "upload",
		component: _import("device/upload"),
		hidden: true,
		meta: {title: "数据上传"}
	  },
	  {
		path: "/device/flush",
		name: "flush",
		component: _import("device/flush"),
		hidden: true,
		meta: {title: "清除数据"}
	  },
	  {
		path: "/device/datas",
		name: "datas",
		component: _import("device/datas"),
		hidden: true,
		meta: {title: "数据监控"}
	  },
	]
  },
  {
	path: "/404",
	component: _import("error/404"),
	hidden: true,
	meta: {title: "页面没找到"}
  },
  {
	path: "/401",
	component: _import("error/401"),
	hidden: true,
	meta: {title: "没有相关权限"}
  },
  {path: "*", redirect: "/404", hidden: true}
];

export const asyncRouterMap = [];

export default new Router({
  mode: "hash",
  routes: constantRouterMap.concat(asyncRouterMap)
});
